home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJEMU106.ARJ / E25.CC < prev    next >
C/C++ Source or Header  |  1991-04-25  |  1KB  |  60 lines

  1. #include "emu.h"
  2. #include "rmov.h"
  3. #include "compare.h"
  4.  
  5. void emu_25()
  6. {
  7.   if (empty())
  8.     return;
  9.   if (modrm > 0277)
  10.   {
  11.     // fucompp
  12.     if ((modrm&7) != 1)
  13.       emu_bad();
  14.     else
  15.     {
  16.     if (empty(modrm&7))
  17.     {
  18.       setcc(SW_C3|SW_C2|SW_C0);
  19.       return;
  20.     }
  21.     int c = compare(st(), st(1));
  22.     st().tag = TW_E;
  23.     top++;
  24.     st().tag = TW_E;
  25.     top++;
  26.     int f;
  27.     if (c & COMP_SNAN)
  28.     {
  29.       exception(EX_I);
  30.       f = SW_C3 | SW_C2 | SW_C0;
  31.     }
  32.     else
  33.       switch (c)
  34.       {
  35.         case COMP_A_LT_B:
  36.           f = SW_C0;
  37.           break;
  38.         case COMP_A_EQ_B:
  39.           f = SW_C3;
  40.           break;
  41.         case COMP_A_GT_B:
  42.           f = 0;
  43.           break;
  44.         case COMP_NOCOMP:
  45.           f = SW_C3 | SW_C2 | SW_C0;
  46.           break;
  47.       }
  48.     setcc(f);
  49.     }
  50.   }
  51.   else
  52.   {
  53.     // fisubr m32int
  54.     reg t1, t2;
  55.     r_mov((long *)get_modrm(), t1);
  56.     r_sub(t1, st(), t2);
  57.     r_mov(t2, st());
  58.   }
  59. }
  60.